//
//  LevelCollectionViewCell.m
//  WayToHome
//
//  Created by A-01 on 2020/6/22.
//  Copyright © 2020 A-01. All rights reserved.
//

#import "LevelCollectionViewCell.h"

@implementation LevelCollectionViewCell


-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        //设置控件
        [self setupUI];
    }
    
    return self;
}


- (void)setupUI{
    
    self.backgroundColor = [UIColor colorWithHexString:@"0AB966"];
    
    UIImageView * leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 38, 38)];
    
    leftImageView.backgroundColor = ZRWhiteColor;
    
    self.iconImageView = leftImageView;
    
    [self.contentView addSubview:leftImageView];
    
    
    UILabel * titleLab = [UILabel new];
    
    titleLab.textColor = ZRWhiteColor;
    titleLab.font = [UIFont boldSystemFontOfSize:20];
    titleLab.textAlignment = NSTextAlignmentCenter;
    
    self.titleLab = titleLab;
    
    [self.contentView addSubview:self.titleLab];
}


- (void)layoutSubviews{
    
    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.leading.mas_equalTo(self.contentView).offset(5);
        make.width.height.mas_equalTo(38);
    }];
    
    [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.contentView);
        make.leading.mas_equalTo(self.iconImageView.mas_trailing).offset(5);
        make.trailing.mas_equalTo(self.contentView).offset(-5);
    }];
}

@end
